package sis.studentinfo;/*
 * @auther 顶风少年
 * @mail dfsn19970313@foxmail.com
 * @date 2019-07-26 09:38
 * @notify
 * @version 1.0
 */

import java.io.Serializable;

//课程
public class Course extends Object implements Serializable {
    //课程系名
    private String department;
    //课程编号
    private String number;

    public Course(String department, String number) {
        this.department = department;
        this.number = number;
    }

    public String getDepartment() {
        return this.department;
    }

    public String getNumber() {
        return number;
    }

    public boolean equals(Object object) {
        if (object == null) {
            return false;
        }
        //这种情况不考虑 继承与实现
        if (this.getClass() != object.getClass()) {
            return false;
        }
        //这种情况运行继承 或者实现
//        if (!(object instanceof Course)) {
//            return false;
//        }
        Course that = (Course) object;
        return this.department.equals(that.department) && this.number.equals(that.getNumber());
    }

    public int hashCode() {
        final int hashMultiplier = 41;
        int result = 7;
        result = result * hashMultiplier + department.hashCode();
        result = result * hashMultiplier + number.hashCode();
        return result;
    }

    public String toString() {
        return department + " " + number;
    }


}
